#delimit ;
*REStat paper, breastfeeding and children's early cognitive outcomes;
log using h:/local_c/bfeed3/mns082.log, replace;
clear;
set mem 40m;
set more off;
set matsize 800;

use h:/local_c/bfeed3/mns082;

gen custwtx = int(custwt);

drop custwt;

gen cwtfullx = int(cwtfull);

drop cwtfull;

gen sibwtx = int(sibwt);

drop sibwt;

replace home56 = home56/10;

sum [fweight=custwtx];
sum if bfeed==0 [fweight=custwtx];
sum if bfeed==1 [fweight=custwtx];
sum if bf14==1 [fweight=custwtx];
sum if bf512==1 [fweight=custwtx];
sum if bf1325==1 [fweight=custwtx];
sum if bf26p==1 [fweight=custwtx];

**missing obs., dvs;
replace regnc = 0 if regdv == 1;
replace regs = 0 if regdv == 1;
replace regw = 0 if regdv == 1;

replace prenat1 = 0 if predv == 1;
replace msmoke = 0 if predv == 1;
replace csect = 0 if predv == 1;

replace gestlt35 = 0 if gestdv == 1;
replace gest3537 = 0 if gestdv == 1;

replace bw55 = 0 if bw55dv == 1;

replace afqt = 0 if afqtdv == 1;

replace home56 = 0 if homedv == 1;

replace ptp = 0 if pftpdv == 1;
replace ftp = 0 if pftpdv == 1;

replace pt12 = 0 if pfty1dv == 1;
replace ft12 = 0 if pfty1dv == 1;
replace pt13 = 0 if pfty1dv == 1;
replace ft13 = 0 if pfty1dv == 1;
replace pt52 = 0 if pfty1dv == 1;
replace ft52 = 0 if pfty1dv == 1;

replace pty2 = 0 if pfty24dv == 1;
replace fty2 = 0 if pfty24dv == 1;
replace pty3 = 0 if pfty24dv == 1;
replace fty3 = 0 if pfty24dv == 1;
replace pty4 = 0 if pfty24dv == 1;
replace fty4 = 0 if pfty24dv == 1;

replace lninc56 = 0 if inc56dv == 1;

replace sped = 0 if speddv == 1;
replace sped = 0 if marbirth == 0;

**alternative post-birth employment measures;
replace hwk12a = 0 if hy1adv == 1;
replace hwk13a = 0 if hy1adv == 1;
replace hwk52a = 0 if hy1adv == 1;
replace pwk12 = 0 if hy1adv == 1;
replace pwk13 = 0 if hy1adv == 1;
replace pwk52 = 0 if hy1adv == 1;

replace hwky2a = 0 if ha24dv == 1;
replace hwky3a = 0 if ha24dv == 1;
replace hwky4a = 0 if ha24dv == 1;
replace pwky2 = 0 if ha24dv == 1;
replace pwky3 = 0 if ha24dv == 1;
replace pwky4 = 0 if ha24dv == 1;

**experiment at end, add all sorts of variables;
replace pre56 = 0 if hdstdv == 1;
replace hdst56 = 0 if hdstdv == 1;

replace marr56 = 0 if marrdv == 1;
replace sep56 = 0 if marrdv == 1;
replace div56 = 0 if marrdv == 1;
replace wid56 = 0 if marrdv == 1;

replace sppaw56 = 0 if sppa56dv == 1;
replace sppaed56 = 0 if sppa56dv == 1;


**sum [fweight=custwtx];

**'plain' specification;
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv 
				 [pweight=custwtx]
                 , robust cluster(r0000100); 

reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv 
				 [pweight=custwtx]
                 , robust cluster(r0000100); 

**ADD AFQT;
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx], robust cluster(r0000100); 

reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx], robust cluster(r0000100); 

				  				 
**Add Maternal Employment;
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv
                 [pweight=custwtx], robust cluster(r0000100); 

reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv [pweight=custwtx], robust cluster(r0000100); 

				 
**alternative maternal employment post-birth measures;
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv
                 hwk12a hy1adv hwk13a hwk52a hwky2a ha24dv hwky3a hwky4a 
                 [pweight=custwtx], robust cluster(r0000100); 

reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv
                 hwk12a hy1adv hwk13a hwk52a hwky2a ha24dv hwky3a hwky4a  [pweight=custwtx], robust cluster(r0000100); 
				 
	
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv
                 pwk12 hy1adv pwk13 pwk52 pwky2 ha24dv pwky3 pwky4 
                 [pweight=custwtx], robust cluster(r0000100); 

reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv
                 pwk12 hy1adv pwk13 pwk52 pwky2 ha24dv pwky3 pwky4  [pweight=custwtx], robust cluster(r0000100); 
		
				 
**ADD age 5/6 home score, log income age 5/6;
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv home56 homedv 
                 lninc56 inc56dv 
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv
                 [pweight=custwtx], robust cluster(r0000100); 

reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv 
                 afqt afqtdv home56 homedv 
                 lninc56 inc56dv
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv 
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv
                 [pweight=custwtx], robust cluster(r0000100); 

**now, do with bf dummy variables instead;
**'plain' specification;
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv 
                 [pweight=custwtx], robust cluster(r0000100); 

reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 [pweight=custwtx], robust cluster(r0000100); 
				 

**ADD AFQT;
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv [pweight=custwtx], robust cluster(r0000100); 

reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv [pweight=custwtx], robust cluster(r0000100); 				 
				 
**add maternal employment;
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv
                 [pweight=custwtx], robust cluster(r0000100); 

reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv [pweight=custwtx], robust cluster(r0000100); 

**ADD age 5/6 home score, log income age 5/6;
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv home56 homedv 
                 lninc56 inc56dv 
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv
                 [pweight=custwtx], robust cluster(r0000100); 

reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv 
                 afqt afqtdv home56 homedv 
                 lninc56 inc56dv
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv 
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv
                 [pweight=custwtx], robust cluster(r0000100); 

**try stratifying, just pre-treatment chars;
**by race/ethnicity;
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if cblack==0 & chisp==0, robust cluster(r0000100); 
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if cblack==1, robust cluster(r0000100); 
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if chisp==1, robust cluster(r0000100); 
reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if cblack==0 & chisp==0, robust cluster(r0000100); 
reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if cblack==1, robust cluster(r0000100); 
reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if chisp==1, robust cluster(r0000100); 

				 
**by education;				 
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79  marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if hgcyob < 12, robust cluster(r0000100); 
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79  marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if hgcyob == 12, robust cluster(r0000100); 
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79  marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if hgcyob > 12, robust cluster(r0000100); 
reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79  marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if hgcyob < 12, robust cluster(r0000100); 
reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79  marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if hgcyob == 12, robust cluster(r0000100); 
reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79  marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if hgcyob > 12, robust cluster(r0000100); 
*by age;
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if agebirth <=22, robust cluster(r0000100); 
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if agebirth > 22 & agebirth < 30, robust cluster(r0000100); 				 
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if agebirth >= 30, robust cluster(r0000100); 				 
reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if agebirth <=22, robust cluster(r0000100); 
reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if agebirth > 22 & agebirth < 30, robust cluster(r0000100); 				 
reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if agebirth >= 30, robust cluster(r0000100); 				 
				  
*by AFQT score;
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 [pweight=custwtx] if afqtdv == 0 & afqt < 0, robust cluster(r0000100); 
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                [pweight=custwtx] if afqtdv == 0 & afqt >= 0, robust cluster(r0000100); 
reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 [pweight=custwtx] if afqtdv == 0 & afqt < 0, robust cluster(r0000100); 
reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 [pweight=custwtx] if afqtdv == 0 & afqt >= 0, robust cluster(r0000100); 
	
	**same with bf dummy variables;
	
	**by race/ethnicity;
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if cblack==0 & chisp==0, robust cluster(r0000100); 
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if cblack==1, robust cluster(r0000100); 
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if chisp==1, robust cluster(r0000100); 
reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if cblack==0 & chisp==0, robust cluster(r0000100); 
reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if cblack==1, robust cluster(r0000100); 
reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if chisp==1, robust cluster(r0000100); 

				 
**by education;				 
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79  marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if hgcyob < 12, robust cluster(r0000100); 
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79  marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if hgcyob == 12, robust cluster(r0000100); 
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79  marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if hgcyob > 12, robust cluster(r0000100); 
reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79  marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if hgcyob < 12, robust cluster(r0000100); 
reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79  marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if hgcyob == 12, robust cluster(r0000100); 
reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79  marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if hgcyob > 12, robust cluster(r0000100); 
*by age;
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if agebirth <=22, robust cluster(r0000100); 
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if agebirth > 22 & agebirth < 30, robust cluster(r0000100); 				 
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if agebirth >= 30, robust cluster(r0000100); 				 
reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if agebirth <=22, robust cluster(r0000100); 
reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if agebirth > 22 & agebirth < 30, robust cluster(r0000100); 				 
reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                  afqt afqtdv [pweight=custwtx] if agebirth >= 30, robust cluster(r0000100); 				 
				  
*by AFQT score;
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 [pweight=custwtx] if afqtdv == 0 & afqt < 0, robust cluster(r0000100); 
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                [pweight=custwtx] if afqtdv == 0 & afqt >= 0, robust cluster(r0000100); 
reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 [pweight=custwtx] if afqtdv == 0 & afqt < 0, robust cluster(r0000100); 
reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 [pweight=custwtx] if afqtdv == 0 & afqt >= 0, robust cluster(r0000100); 

**what if interact home score with bfeed;
	gen bfhome = bfeed*home56;
gen bfhdv = bfeed*homedv;
	
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv home56 homedv 
                 lninc56 inc56dv 
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv bfhome bfhdv
                 [pweight=custwtx], robust cluster(r0000100); 

reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv 
                 afqt afqtdv home56 homedv 
                 lninc56 inc56dv
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv 
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv bfhome bfhdv
                 [pweight=custwtx], robust cluster(r0000100); 

	
**what if add a bunch more post-treatment variables;	
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv home56 homedv 
                 lninc56 inc56dv 
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv 
				 pre56 hdst56 hdstdv marr56 sep56 div56 wid56 marrdv sppa56 sppaw56 sppaed56 sppa56dv
                 [pweight=custwtx], robust cluster(r0000100); 
	
	
reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv home56 homedv 
                 lninc56 inc56dv 
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv 
				 pre56 hdst56 hdstdv marr56 sep56 div56 wid56 marrdv sppa56 sppaw56 sppaed56 sppa56dv
                 [pweight=custwtx], robust cluster(r0000100); 

				 
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv home56 homedv 
                 lninc56 inc56dv 
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv 
				 pre56 hdst56 hdstdv marr56 sep56 div56 wid56 marrdv sppa56 sppaw56 sppaed56 sppa56dv
                 [pweight=custwtx], robust cluster(r0000100); 
	
	
reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv home56 homedv 
                 lninc56 inc56dv 
                 pt12 ft12 pt13 ft13 pt52 ft52 pfty1dv
                 pty2 fty2 pty3 fty3 pty4 fty4 pfty24dv 
				 pre56 hdst56 hdstdv marr56 sep56 div56 wid56 marrdv sppa56 sppaw56 sppaed56 sppa56dv
                 [pweight=custwtx], robust cluster(r0000100); 

	
**now sibling sample;
**for the fixed effects part;
sort r0000100;
by r0000100: gen x=_N;

**what if just run on singletons;
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv 
                 afqt afqtdv [pweight=custwt] if x==1, robust cluster(r0000100); 

reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv [pweight=custwt] if x==1, robust cluster(r0000100); 


reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv 
                 afqt afqtdv [pweight=custwt] if x==1, robust cluster(r0000100); 

reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv [pweight=custwt] if x==1, robust cluster(r0000100); 

drop if x==1;

**now just with siblings, using full weights;
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv 
                 afqt afqtdv [pweight=custwt], robust cluster(r0000100); 

reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv [pweight=custwt], robust cluster(r0000100); 


reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv 
                 afqt afqtdv [pweight=custwt], robust cluster(r0000100); 

reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv [pweight=custwt], robust cluster(r0000100); 


*********now with sibling weights*****************************;
**ADD AFQT;
reg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv 
                 afqt afqtdv [pweight=sibwt], robust cluster(r0000100); 

reg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv [pweight=sibwt], robust cluster(r0000100); 

areg math56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv [pweight=sibwt], absorb(r0000100) robust cluster(r0000100); 
				 
				 
areg read56 bfeed cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv [pweight=sibwt], absorb(r0000100) robust cluster(r0000100); 

**now with bf dvs;
**ADD AFQT;
reg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv [pweight=sibwt], robust cluster(r0000100); 

reg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv [pweight=sibwt], robust cluster(r0000100); 

areg math56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv [pweight=sibwt], absorb(r0000100) robust cluster(r0000100); 
				 
				 
areg read56 bf14 bf512 bf1325 bf26p cfemale cblack chisp pwhte bapt79 cath79 hgcyob marbirth ptp ftp pftpdv
                 agebirth momfor regnc regs regw regdv prenat1 msmoke csect predv
                 border1 border2 bw55 bw55dv gestlt35 gest3537 gestdv sped speddv
                 afqt afqtdv [pweight=sibwt], absorb(r0000100) robust cluster(r0000100); 				 


sort r0000100;
				
by r0000100:  egen bfm=mean(bfeed);
by r0000100:  egen bfm1 = mean(bf14);
by r0000100:  egen bfm2 = mean(bf512);
by r0000100:  egen bfm3 = mean(bf1325);
by r0000100:  egen bfm4 = mean(bf26p);


*drop if bfm == 0;
*drop if bfm1 ==1;
*drop if bfm2==1;
*drop if bfm3==1;
*drop if bfm4==1;
*drop if bfm1==0 & bfm2==0 & bfm3==0 & bfm4==0;

**now with bf dvs;

**now, bf or not sibs different;
*drop if bfm==0;
**already did the above, but here so see conditions;
*drop if bfm==1;

		
clear matrix;
				 
log close;
